package com.fable.sp.core.repository;

import com.fable.sp.core.domain.WidgetInstance;
import com.slyak.spring.jpa.GenericJpaRepository;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

/**
 * .
 *
 * @author stormning on 16/8/1.
 */
public interface WidgetInstanceRepository extends GenericJpaRepository<WidgetInstance, Long> {
    @Override
    @Cacheable(cacheManager = "spCacheManager", value = "w_findOne", key = "#p0")
    WidgetInstance findOne(Long id);

    @Override
    @CacheEvict(cacheManager = "spCacheManager", value = "w_findOne", key = "#p0.id")
    <S extends WidgetInstance> S save(S entity);
}
